package com.bjgov.scoresys.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class UserForm extends ActionForm{

	private static final long serialVersionUID = 5417416673036001829L;
	
	private int id;
	private String userName;
	private String realName;
	private String passwd;
	private short authority;
	private short status;
	
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPasswd() {
		return passwd;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public short getAuthority() {
		return authority;
	}

	public void setAuthority(short authority) {
		this.authority = authority;
	}

	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		super.reset(mapping, request);
	}

	public short getStatus() {
		return status;
	}

	public void setStatus(short status) {
		this.status = status;
	}

	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors err = new ActionErrors();
        //验证码验证
        if(StringUtils.isEmpty(userName)){
            err.add("nameError",new ActionMessage("jsp.login.name.error"));
        }if(StringUtils.isEmpty(passwd)){
        	err.add("nameError",new ActionMessage("jsp.login.passwd.error"));
        }
        return err;
	}
}
